package com.aba.cms5zu.student;
import java.util.HashMap;
import java.util.Map;
import com.aba.cms5zu.houseparent.Houseparent;

public class Student {
        private String studentId;
        private String name;
        private String dormRoom;
         private Map<String, String> studentlInfo = new HashMap<>(); // 个人信息
        private Map<String, String> dormInfo = new HashMap<>();      // 寝室信息

        // 登录验证（简化示例，实际需对接数据库）
        public boolean login(String studentId, String password) {
            return "2025001".equals(studentId) && "student123".equals(password);
        }

        public void logout() {
            System.out.println("学生退出系统");
        }

        // 登记个人信息
        public void registerInfo(Map<String, String> info) {
            studentlInfo.putAll(info);
            System.out.println("个人信息登记完成");
        }

        // 查询寝室信息（简化示例，实际需对接数据）
        public void queryDorm(String dormId) {
            dormInfo.put("dormId", dormId);
            dormInfo.put("building", "3号楼");
            dormInfo.put("room", "305");
            System.out.println("寝室信息：" + dormInfo);
        }
        // 构造方法
        public Student(String studentId, String name, String dormRoom) {
            this.studentId = studentId;
            this.name = name;
            this.dormRoom = dormRoom;
        }
        public Student() {
            super();
        }
        // 查看寝室信息
        public void viewDormInfo() {
            System.out.println("学生：" + name + "（学号：" + studentId + "）");
            System.out.println("当前寝室：" + dormRoom);
        }

        // 申请维修（简化逻辑，可调用宿管接口）
        /*
         * public void applyRepair(String problem) { System.out.println("[" + name +
         * "] 申请维修：" + problem); }
         */
        public void applyRepair(String problem, Houseparent houseparent) {
            Houseparent.RepairRequest request = new Houseparent.RepairRequest(name, problem);
            System.out.println("学生：创建维修申请对象:学生：" + name + "，问题：" + problem); // 添加调试输出
            houseparent.receiveRepairRequest(request);
            /* System.out.println("[" + name + "] 申请维修：" + problem); */
        }

        // Getter 和 Setter
        public String getDormRoom()
        {
            return dormRoom; 
        }
        public void setDormRoom(String dormRoom)
        {
            this.dormRoom = dormRoom; 
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getStudentId() {
            return studentId;
        }

        public void setStudentId(String studentId) {
            this.studentId = studentId;
        }
        
    }